<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>echarts</title>
    <style>
      .chart {
        width: 800px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div class="chart"></div>
    <script src="./echarts.min.js"></script>
    <script>
      const myEcharts = echarts.init(document.querySelector(".chart"));

      function getRandomValues() {
        const values = [];

        for (let index = 0; index < 7; index++) {
          values.push(Math.round(Math.random() * 100 + 50));
        }

        return values;
      }

      const option = {
        xAxis: {
          data: [
            "星期一",
            "星期二",
            "星期三",
            "星期四",
            "星期五",
            "星期六",
            "星期天",
          ],
        },
        yAxis: {},
        series: [
          {
            type: "bar",
            data: getRandomValues(),
          },
          {
            type: "line",
            data: getRandomValues(),
          },
          {
            type: "pie",
            data: [
              { name: "xxx", value: 111 },
              { name: "yyy", value: 222 },
              { name: "zzz", value: 333 },
            ],
            radius: 30, // 半径
            center: [600, 50], // 圆心的坐标
          },
        ],
      };
      myEcharts.setOption(option);
    </script>
  </body>
</html>
